//
//  CategoryBoard.swift
//  Keep1
//
//  Created by 王志涛 on 2021/3/1.
//

import SwiftUI

private let kCategorySpace: CGFloat = 20

struct CategoryBoard: View {
    private let boardWidth = UIScreen.main.bounds.width - 30
    private let height: CGFloat = 191
    private let boardColor = Color(.white)
    
    
    var body: some View {
        ZStack{
            VStack(spacing: 20){
                CategoryCellsRow()
            }
        }
        .frame(width: boardWidth, height: 191)
        .background(boardColor)
        .cornerRadius(20)
        .overlay(RoundedRectangle(cornerRadius: 20)
                    .stroke(borderColor,lineWidth: 1))
    }
}

struct CategoryBoard_Previews: PreviewProvider {
    static var previews: some View {
        CategoryBoard()
            .frame(width: UIScreen.main.bounds.width,height: UIScreen.main.bounds.height)
            .background(Color(.gray))
    }
}

struct CategoryCellsRow: View {
    var body: some View {
            VStack(spacing:20){
                HStack(spacing: 60){
                    CategoryBtnCell(name: "人气课", image: "hot")
                    CategoryBtnCell(name: "人气课", image: "hot")
                    CategoryBtnCell(name: "人气课", image: "hot")
                }
                HStack(spacing: 60){
                    CategoryBtnCell(name: "人气课", image: "hot")
                    CategoryBtnCell(name: "人气课", image: "hot")
                    CategoryBtnCell(name: "人气课", image: "hot")
                }
            }
            
    }
}

struct CategoryBtnCell: View {
    let name: String
    let image: String
    var body: some View {
        VStack{
            Image(image)
            Text(name)
        }
    }
    
}
